-
Notifications
You must be signed in to change notification settings - Fork 53
Add analyzer to suggest input parameter binding over GetInput() #550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: YunchuWang <[email protected]>
Co-authored-by: YunchuWang <[email protected]>
Co-authored-by: YunchuWang <[email protected]>
|
@copilot resolve conflict |
Co-authored-by: YunchuWang <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a new Roslyn analyzer (DURABLE0009) that suggests using input parameter binding instead of calling ctx.GetInput<T>() in orchestration methods. This is an informational diagnostic to guide developers toward the preferred pattern, especially since GetInput<T>() is marked as potentially deprecated in the codebase.
Key Changes:
- Implements
GetInputOrchestrationAnalyzerwith Info severity to detectctx.GetInput<T>()usage - Adds comprehensive test coverage for various orchestration patterns (Durable Functions, TaskOrchestrator, and OrchestratorFunc)
- Includes resource strings for diagnostic messages
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/Analyzers/Orchestration/GetInputOrchestrationAnalyzer.cs |
New analyzer detecting GetInput() usage in orchestration methods and suggesting input parameter binding |
test/Analyzers.Tests/Orchestration/GetInputOrchestrationAnalyzerTests.cs |
Comprehensive test suite covering empty code, non-orchestrations, various orchestration patterns, nested calls, and multiple invocations |
src/Analyzers/Resources.resx |
Resource strings for analyzer title and message format |
src/Analyzers/AnalyzerReleases.Unshipped.md |
Documentation entry for new DURABLE0009 diagnostic |
|
@copilot update pr description to follow .github/PULL_REQUEST_TEMPLATE.md |
|
LGTM |
Updated PR description to follow SummaryWhat changed?
Why is this change needed?The Issues / work itemsProject checklist
AI-assisted code disclosure (required)Was an AI tool used?
If AI was used:
AI verification:
TestingAutomated tests
Manual validation
Notes for reviewers
|

Summary
What changed?
GetInputOrchestrationAnalyzer(DURABLE0009) that detects usage ofctx.GetInput<T>()in orchestration methodsAnalyzerReleases.Unshipped.mdWhy is this change needed?
The
GetInput<T>()method is marked as potentially deprecated and input parameter binding is the recommended approach for accessing orchestration input. This Info-level analyzer helps guide developers toward the preferred pattern without blocking their builds.Issues / work items
Project checklist
AI-assisted code disclosure (required)
Was an AI tool used?
If AI was used:
src/Analyzers/Orchestration/GetInputOrchestrationAnalyzer.cs(analyzer implementation)test/Analyzers.Tests/Orchestration/GetInputOrchestrationAnalyzerTests.cs(test suite)src/Analyzers/Resources.resx(diagnostic messages)src/Analyzers/AnalyzerReleases.Unshipped.md(release tracking)operation.TargetMethodbased on code review feedbackCSharpCodeFixVerifiertoCSharpAnalyzerVerifierfor consistencyAI verification:
Testing
Automated tests
Manual validation
context.GetInput<T>()usageNotes for reviewers
[OrchestrationTrigger],TaskOrchestrator<TInput, TOutput>classes, andAddOrchestratorFunclambdasCSharpAnalyzerVerifierinstead ofCSharpCodeFixVerifierOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.